import HYRequest from './request'
import {showDialog} from 'vant'
 
const hyRequest = new HYRequest({
  baseURL: '',
  timeout: 10000,
  interceptors: {
    requestInterceptor: (config) => {
      const token = ''
      if (token) {
        config.headers!.Authorization = token
      }
      console.log('请求成功拦截')
      return config
    },
 
    requestInterceptorCatch: (err) => {
      showDialog({ message: `'请求发生错误!',${err}` });
      return err
    },
    responseInterceptor: (config) => {
      console.log('res---',config)
      return config
    },
    responseInterceptorCatch: (err) => {
      showDialog({ message: `'响应发生错误!',${err}` });
      return err
    }
  }
})
 
export default hyRequest